<button
  nz-button
  nz-tooltip="Revert to Submitted"
  nzSize="small"
  (click)="showConfirm = true"
  [nzLoading]="isSubmitting">
  <i
    nz-icon
    nzType="undo"></i>
</button>

<nz-modal
  [(nzVisible)]="showConfirm"
  [nzContent]="confirmModalContent"
  [nzTitle]="confirmModalTitle"
  [nzFooter]="null"
  (nzOnCancel)="handleConfirmModalCancel()">
  <ng-template #confirmModalTitle
    ><span>Revert this {{ entityType }} to Submitted?</span></ng-template
  >
  <ng-template #confirmModalContent>
    <nz-spin [nzSpinning]="isSubmitting">
      <nz-space nzDirection="horizontal">
        <span *nzSpaceItem>
          <button
            nzType="primary"
            nzSize="small"
            nz-button
            (click)="revert()"
            nz-tooltip
            [nzTooltipTrigger]="mostRecentOrg ? 'hover' : null"
            [nzTooltipTitle]="'For ' + mostRecentOrg?.name">
            Revert
          </button>
        </span>
        <span *nzSpaceItem>
          <button
            nz-button
            (click)="showConfirm = false"
            nzSize="small">
            Cancel
          </button>
        </span>
      </nz-space>
    </nz-spin>
  </ng-template>
</nz-modal>
